﻿using System;
using System.Collections.Generic;
using System.Text;

namespace StarBotDotNet.Tournament1.ZergBattle
{
    public class ZergAgent : IAgent
    {

        int sleepTime = int.Parse(System.Configuration.ConfigurationSettings.AppSettings["sleepTime"]);
        UnitManager units = new UnitManager();

        public ZergAgent()
        {

        }

        #region IAgent Members

        void IAgent.start()
        {
            ProxyBot bot = ProxyBot.Proxy;

            CurrentPlayer.PlayerID = bot.PlayerID;

            units.AddParty(new AttackParty(bot));

            int currentTime = 0;

            while (true)
            {
                // This try/catch is useless.
                try
                {
                    System.Threading.Thread.Sleep(sleepTime);
                }
                catch (Exception)
                {
                }

                currentTime += sleepTime;
                units.RunUnitManager(bot.Units, currentTime, bot);
            }
        }

        #endregion
    }
}
